/*----------------------------------------\ | Return the current system date or datetime; | |-------------------------------------------| |--------------------------------------------------------------------| |---------------------------| | Inputs: | | datetimeformat - the output datetime format: either a date format| | or a datetime format; | |--------------------------------------| |--------------------------------------------------------------------| |---------------------------------------| | Example: %put %now(worddate20.); | | Usage: %now(datetimeformat); | \----------------------------------------*/ %macro now/parmbuff; %let syspbuff=%debracket(&syspbuff); %if (%length(%sysfunc(compress(&syspbuff))) le 1) %then %do; %let syspbuff=datetime22.; %sysfunc(datetime(), &syspbuff); %end; %else %if (%index(%sysfunc(compress(%quote(%upcase(&syspbuff)))), DATETIME)) %then %sysfunc(datetime(), &syspbuff); %else %if ((%length(%sysfunc(compress(&syspbuff))) gt 1) and (not %index(%quote(%upcase(&syspbuff)), DATETIME))) %then %sysfunc(date(), &syspbuff); %mend now;